package app.texas.com.devilfishhouse.AppConfig;

import android.content.Context;

import static com.universal_library.utils.DeviceUtil.getDisplayMetrics;

/**
 * Created by lenovo on 2018/5/22.
 */

public class AppContext extends MyApplication {


    public static String localCity = "";
    public static String userphone;

    public static String token;


    /**
     * 获取手机屏幕高度
     *
     * @param context
     * @return
     */
    public static float getScreenHeight(Context context) {
        return getDisplayMetrics(context).heightPixels;
    }

    /**
     * 获取手机屏幕宽度
     *
     * @param context
     * @return
     */
    public static float getScreenWidth(Context context) {
        return getDisplayMetrics(context).widthPixels;
    }

    public static float getStatusBarH(Context context) {
        int statusBarHeight1 = -1;
        //获取status_bar_height资源的ID
        int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
        if (resourceId > 0) {
            //根据资源ID获取响应的尺寸值
            statusBarHeight1 = context.getResources().getDimensionPixelSize(resourceId);
        }
        return statusBarHeight1;

    }
}
